package com.czk.model.combile;

import java.util.ArrayList;
import java.util.List;

public class University extends OrganizationCompnent {
    // 组合学院
    List<OrganizationCompnent> organizationCompnents=new ArrayList<>();

    // 构造器
    public University(String name, String des) {
        super(name, des);
    }

    @Override
    protected void print() {
        // 输出学校包含的学院
        System.out.println(getName());
        for (OrganizationCompnent organizationCompnent : organizationCompnents) {
            System.out.println(organizationCompnent.getName());
            organizationCompnent.print();
        }
    }

    @Override
    protected void add(OrganizationCompnent organizationCompnent) {
        this.organizationCompnents.add(organizationCompnent);
    }

    @Override
    protected void remove(OrganizationCompnent organizationCompnent) {
        this.organizationCompnents.remove(organizationCompnent);
    }
}
